package com.mzy.datepackage.M2022.July.twtwo;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/8/25 16:30
 * @Version 1.0
 */
public class TestListComponent {
    public static void main(String[] args) {
        List<User> userList=new ArrayList<>();
        for(int i=1;i<=30;i++){
            User user=new User();
            user.setUserId(i);
            user.setName(i+"name");
            userList.add(user);
        }
        List<Employee> employeeList=new ArrayList<>();
        for(int i=1;i<=30;i++){
            Employee employee=new Employee();
            employee.setEmployeeId(i);

            employeeList.add(employee);
        }

        System.out.println("===="+isALLCheckpointHasTime(userList,employeeList));

    }


    public static boolean isALLCheckpointHasTime(List<User> userList, List<Employee> employeeList){

        //将列表中需要比较的对象拿出来
        List<Integer>  userIntList=userList.stream().map(User::getUserId).collect(Collectors.toList());
        List<Integer>  employeeIntList= employeeList.stream().map(Employee::getEmployeeId).collect(Collectors.toList());
        userIntList.forEach(e -> System.out.println(e));
        employeeIntList.forEach(e -> System.out.println(e));
        if(userIntList.equals(employeeIntList)){
            System.out.println("ss");
            return true;
        }
        //遍历一个对象，查看另外一个list中是否存在
        return  !userIntList.retainAll(employeeIntList);
    }
}
